//
//  SQGoodAddressView.m
//  pai
//
//  Created by pro on 14-12-4.
//  Copyright (c) 2014年 linjunjing. All rights reserved.
//

#import "SQGoodAddressView.h"

@implementation SQGoodAddressView
+(SQGoodAddressView*)initmyview
{
    NSArray* nibView =  [[NSBundle mainBundle] loadNibNamed:@"SQGoodAddressView" owner:nil options:nil];
    return [nibView objectAtIndex:0];
}
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
    }
    return self;
}
-(void)setAddress:(addr_t)address
{
    self.nameLabel.text = [NSString stringWithUTF8String:address.attn];
    self.mobileLabel.text = [NSString stringWithUTF8String:address.phone];
    NSMutableString* addr =[NSMutableString stringWithUTF8String:address.address];
    NSArray* arr = [addr componentsSeparatedByString:@"|"];
    if (arr.count == 1) {
        addr = arr[0];
    }else if(arr.count == 2){
        addr = [NSMutableString stringWithFormat:@"%@%@",arr[0],arr[1]];
    }
    self.addressLabel.text = [NSString stringWithFormat:@"%@%@%@",[NSString stringWithUTF8String:address.province],[NSString stringWithUTF8String:address.city],addr];
}
@end
